package com.example.design.patterns.geekbang.行为型.策略模式.refactor;

import com.example.design.patterns.geekbang.行为型.策略模式.demo.Order;
import com.example.design.patterns.geekbang.行为型.策略模式.demo.OrderType;

// 策略的使用
public class OrderService {
    public double discount(Order order) {
        OrderType type = order.getType();
        DiscountStrategy discountStrategy = DiscountStrategyNoStateFactory.getDiscountStrategy(type);
        return discountStrategy.calDiscount(order);
    }
}
